package com.ruoyi.web.controller.app.borehole;

import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.validate.QueryGroup;
import com.ruoyi.web.domain.query.AddReportQuery;
import com.ruoyi.web.domain.query.ReportPageQuery;
import com.ruoyi.web.domain.vo.ReportPageVO;
import com.ruoyi.web.service.BhReportService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Tag(name = "作业报备-App端")
@RestController
@RequestMapping("/app/jobReport")
public class AppBhReportController {

    @Autowired
    private BhReportService bhReportService;

    @Operation(summary = "作业报备列表页 - 分页查询")
    @GetMapping("/getReportPage")
    public TableDataInfo<ReportPageVO> getReportPage(@Validated(QueryGroup.class) ReportPageQuery reportPageQuery, PageQuery pageQuery) {
        return bhReportService.getReportPage(reportPageQuery, pageQuery);
    }

    @Operation(summary = "新增作业报备")
    @RepeatSubmit
    @PostMapping("/addReport")
    public R<Void> addReport(@RequestBody AddReportQuery addReportQuery) {
        return bhReportService.addReport(addReportQuery);
    }
}
